<script>
	import Vue from 'vue'
	import {
		mapState,
		mapMutations
	} from 'vuex';
	export default {
		onLaunch: function() {

			uni.getSystemInfo({
				success: function(e) {
					Vue.prototype.windowHeight = e.windowHeight;
					Vue.prototype.screenHeight = e.screenHeight;
					Vue.prototype.screenWidth = e.screenWidth;
					// #ifndef MP
					Vue.prototype.StatusBar = e.statusBarHeight;
					if (e.platform == 'android') {
						Vue.prototype.CustomBar = e.statusBarHeight + 50;
					} else {
						Vue.prototype.CustomBar = e.statusBarHeight + 45;
					};
					// #endif

					// #ifdef MP-WEIXIN
					Vue.prototype.StatusBar = e.statusBarHeight;
					let custom = wx.getMenuButtonBoundingClientRect();
					Vue.prototype.Custom = custom;
					Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
					// #endif		

					// #ifdef MP-ALIPAY
					Vue.prototype.StatusBar = e.statusBarHeight;
					Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
					// #endif
				}
			})
			// #ifdef MP-WEIXIN
			    const updateManager = uni.getUpdateManager();
			    uni.getUpdateManager().onUpdateReady(function() {
			      uni.showModal({
			        title: '更新提示',
			        content: '新版本已经准备好，是否重启应用？',
			        success: function(res) {
			          if (res.confirm) {
			            // 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
			            updateManager.applyUpdate()
			          }
			        }
			      })
			    })
			// #endif
		},
		onShow: function() {
			  this.$userJs.checkLogin().then(res => {
					console.log(this.hasLogin);
			    }).catch((err) => {
					console.log(err);
					console.log(this.hasLogin);
			    });
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			...mapMutations(['login', 'setCode']),
		},
		computed: {
			...mapState(['hasLogin', 'user', 'code'])
		}
	}
</script>

<style>
	@import 'static/font/iconfont.css';
	@import 'static/css/style.css';
	@import 'static/css/animate.css';
	@import '@/components/feng-parse/parse.css';

	.container {
		box-sizing: border-box;
		background-color: #f4f4f4;
		font-family: PingFangSC-Light, helvetica, 'Heiti SC';
	}

	view,
	image,
	text,
	navigator {
		box-sizing: border-box;
		padding: 0;
		margin: 0;
	}

	view,
	text {
		font-family: PingFangSC-Light, helvetica, 'Heiti SC';
		font-size: 29rpx;
		color: #333;
	}

	.start {
		width: 122rpx;
		height: 30rpx;
		background-image: url('');
		background-repeat: no-repeat;
		background-size: 122rpx auto;
	}

	.start.star5 {
		background-position: 0 3rpx;
	}

	.start.star4 {
		background-position: 0 -30rpx;
	}

	.start.star3 {
		background-position: 0 -70rpx;
	}

	.start.star2 {
		background-position: 0 -105rpx;
	}

	.start.star1 {
		background-position: 0 -140rpx;
	}

	.start.star0 {
		background-position: 0 -175rpx;
	}

	page {
		font-size: 28rpx;
		background-color: #f5f5f5;
		color: #333;
	}

	view {
		box-sizing: border-box;
	}

	.acea-row {
		display: flex;
		flex-wrap: wrap;
	}

	.acea-row.row-top {
		align-items: flex-start;
	}

	.acea-row.row-middle {
		align-items: center;
	}

	.acea-row.row-bottom {
		align-items: flex-end;
	}

	.acea-row.row-left {
		justify-content: flex-start;
	}

	.acea-row.row-center {
		justify-content: center;
	}

	.acea-row.row-right {
		justify-content: flex-end;
	}

	.acea-row.row-between {
		justify-content: space-between;
	}

	.acea-row.row-around {
		justify-content: space-around;
	}

	.acea-row.row-column {
		flex-direction: column;
	}

	.acea-row.row-column-between {
		flex-direction: column;
		justify-content: space-between;
	}

	.acea-row.row-column-around {
		flex-direction: column;
		justify-content: space-around;
	}

	.acea-row.row-center-wrapper {
		align-items: center;
		justify-content: center;
	}

	.acea-row.row-between-wrapper {
		align-items: center;
		justify-content: space-between;
	}

	.font-color {
		color: #fc4141 !important;
	}

	.bg-color {
		background-color: #85c43f !important;
	}

	.icon-color {
		color: #85c43f;
	}

	.cart-color {
		color: #85c43f !important;
		border: 1px solid #85c43f !important;
	}

	/* 单选 */
	radio .wx-radio-input {
		border-radius: 50%;
		width: 38rpx;
		height: 38rpx;
	}

	radio .wx-radio-input.wx-radio-input-checked {
		border: 1px solid #e93323 !important;
		background-color: #e93323 !important;
	}

	/* 多选 */
	checkbox .wx-checkbox-input {
		border-radius: 50%;
		width: 38rpx;
		height: 38rpx;
	}

	checkbox .wx-checkbox-input.wx-checkbox-input-checked {
		border: 1px solid #e93323 !important;
		background-color: #e93323 !important;
		color: #fff !important;
	}

	checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
		font-size: 35rpx;
	}

	.line1 {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.line2 {
		word-break: break-all;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	.mask {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background-color: #000;
		opacity: 0.5;
		z-index: 5;
	}

	button {
		padding: 0;
		margin: 0;
		line-height: normal;
		background-color: #fff;
	}

	button::after {
		border: 0;
	}

	@keyframes load {
		from {
			transform: rotate(0deg);
		}

		to {
			transform: rotate(360deg);
		}
	}

	.loadingpic {
		animation: load 3s linear 1s infinite;
	}

	.loading-list {
		animation: load linear 1s infinite;
		font-size: 40rpx;
		margin-right: 22rpx;
	}

	.loading {
		width: 100%;
		height: 100rpx;
		line-height: 100rpx;
		align-items: center;
		justify-content: center;
		position: relative;
		text-align: center;
	}

	.loading .line {
		position: absolute;
		width: 450rpx;
		left: 150rpx;
		top: 50rpx;
		height: 1px;
		border-top: 1px solid #eee;
	}

	.loading .text {
		position: relative;
		display: inline-block;
		padding: 0 20rpx;
		background: #fff;
		z-index: 2;
		color: #777;
	}

	.loadingicon .loading {
		animation: load linear 1s infinite;
		font-size: 45rpx;
		color: #000;
	}

	.loadingicon {
		width: 100%;
		height: 80rpx;
	}
</style>
